class BaseTeamPath {
  String? id;
  String? teamId;
  String? processId;
  String? processName;
  String? createUid;
  String? createDate;
  String? writeUid;
  String? writeDate;
  // String? departmentId;
  List? processList;
  // String? job;
  // num? postratio;

  BaseTeamPath({
    this.id,
    this.teamId,
    this.processId,
    this.processName,
    this.createUid,
    this.createDate,
    this.writeUid,
    this.writeDate,
    // this.departmentId,
    this.processList,
    // this.job,
    // this.username,
    // this.postratio,
  });

  factory BaseTeamPath.fromMap(Map<String, dynamic> map) {
    return new BaseTeamPath(
      id: map['id'] != false ? map['id'].toString() as String? : "",
      teamId: map['team_id'] != false
          ? map['team_id'].toString() as String?
          : "",
      processId: map['process_id'] != null
          ? map['process_id'][0].toString() as String?
          : map['id'].toString(),
      processName: map['process_id'] != null
          ? map['process_id'][1].toString() as String?
          : map['name'].toString(),
      createUid: map['create_uid'] != false
          ? map['create_uid'].toString() as String?
          : "",
      createDate: map['create_date'] != false
          ? map['create_date'].toString() as String?
          : "",
      writeUid: map['write_uid'] != false
          ? map['write_uid'].toString() as String?
          : "",
      writeDate: map['write_date'] != false
          ? map['write_date'].toString() as String?
          : "",
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'teamId': this.teamId,
      'processId': this.processId,
      'processName': this.processName,
      'createUid': this.createUid,
      'createDate': this.createDate,
      'writeUid': this.writeUid,
      'writeDate': this.writeDate,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    List list = [
      // if (this.departmentId != null && this.departmentId != '')
      //   ['department_id', '=', int.parse(this.departmentId!)],
      // if (this.processList != null && this.processList!.length > 0)
      //   ['user_id', 'not in', this.processList],
      if (this.teamId != null && this.teamId != '')
        ['team_id', '=', int.parse(this.teamId!)],
      if (this.processName != null && this.processName != '')
        ['process_id.name', 'like', '%${this.processName}%'],
    ] as List;

    // ignore: unnecessary_cast
    return list;
  }

  toProcessDomainList() {
    List list = [
      // if (this.departmentId != null && this.departmentId != '')
      //   ['department_id', '=', int.parse(this.departmentId!)],
      if (this.processList != null && this.processList!.length > 0)
        ['id', 'not in', this.processList],
      if (this.processName != null && this.processName != '')
        ['name', 'like', '%${this.processName}%'],
    ] as List;

    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'team_id': int.parse(this.teamId!),
      'process_id': int.parse(this.processId!),
    } as Map<String, dynamic>;
  }


//</editor-fold>

}
